package com.suyang.syt.dao.impl;

import org.springframework.stereotype.Repository;

import com.suyang.syt.dao.interfaces.MessageDao;
import com.suyang.syt.model.Message;
import com.suyang.syt.util.DateFormat;

@Repository
public class MessageDaoImpl extends BaseDaoImpl<Message> implements MessageDao {

	@Override
	public void deleteByIds(String ids) {
		this.executeByHql("delete from Message where id in (" + ids + ")");
	}

	@Override
	public void updateStatus(long id, String timing) throws Exception {
		if (System.currentTimeMillis() >= DateFormat.stringToDate(timing).getTime()) {
			this.executeByHql(" update Message set status=1 where id=? ", id);
		}
	}

}
